﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace OL.FrameCore.Infrastructure.UnitOfWork
{
    public interface IUnitOfWork
    {
        IRepositoryBase<TEntity> GetRepository<TEntity>() where TEntity : class;
        /// <summary>
        /// 直接提交到数据库
        /// </summary>
        void Save();
        IList<T> SqlQuery<T>(string sql, params object[] parameters) where T : new();
        int ExecuteSqlCommand(string sql, params object[] parameters);
    }

    public interface IUnitOfWork<TContext> : IUnitOfWork where TContext : DbContext
    {
        TContext DbContext { get; }
    }

}
